home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Publishing
/
ImagePortfolio
/
Source
/
FileUtils.h
< prev
next >
Wrap
Text File
|
1994-04-01
|
4KB
|
69 lines
// -------------------------------------------------------------------------------------
// FileName: file name utilities
// The FileName class provides a set of utilities for manipulating file names.
// -------------------------------------------------------------------------------------
#import <objc/Object.h>
// -------------------------------------------------------------------------------------
// filename macros
#define FILEUTILS FileUtils
#define fileNAME(F) [FILEUTILS copyFileName:F]
#define fileNAMEXT(F) [FILEUTILS extractFileNameExt:F]
#define fileEXT(F) [FILEUTILS extractFileExt:F]
#define filePATH(F) [FILEUTILS copyFilePath:F]
#define sendDIRECTORY(D,T,M,A) [FILEUTILS sendFileDirectory:D toTarget:T method:M with:A]
// -------------------------------------------------------------------------------------
@interface FileUtils : Object
{
// this object is not intended to be instantiated
}
int methodNumberOfArgs(Object *obj, SEL aSelector);
// -------------------------------------------------------------------------------------
+ sendFileDirectory:(const char*)dirPath toTarget:target method:(SEL)method with:anArg;
// Sends all file names found in the specified directory to the specified target/method,
// one at a time. aMethod must be a selector which accepts two arguments: the first of
// type (char*), into which will be passed a fully qualified file name found in the
// specified directory, and the second od type (id) into which will be passed anArg.
// Returns self if successful, otherwise returns (id)nil.
// Macros: sendDIRECTORY(dirPath,theTarget,aMethod,anArg)
//
// -------------------------------------------------------------------------------------
+ (const char*)extractFileNameExt:(const char*)fileName;
// Returns a pointer to the start of the actual file name in fileName. This is the
// first character following the last '/' found in the null-terminated string.
// Returns fileName if no '/' found.
// Macros: fileNAMEXT(fileName)
// See also: +extractFileExt:, +copyFileName:, +copyFilePath:
//
// -------------------------------------------------------------------------------------
+ (const char*)extractFileExt:(const char*)fileName;
// Returns a pointer to the start of the file name extension in fileName. This is the
// string starting with the last '.' found in the null-terminated string. Returns an
// empty string if no '.' found.
// Macros: fileEXT(fileName)
// See also: +extractFileNameExt:, +copyFileName:, +copyFilePath:
//
// -------------------------------------------------------------------------------------
+ (char*)copyFileName:(const char*)fileName;
// Returns a pointer to a copy of the file name in fileName. This is the string of
// characters following the last '/' up to, but not including, the last '.'. This
// method uses malloc() the create a copy of the string, so free() must be used to free
// storage used by the string.
// Macros: fileNAME(fileName)
// See also: +copyFilePath:, +extractFileNameExt:, +extractFileExt:
//
// -------------------------------------------------------------------------------------
+ (char*)copyFilePath:(const char*)fileName;
// Returns a pointer to a copy of the file path in fileName. This is the string of
// characters starting with the first character in the file path name up to, but not
// including, the last '/'. This method uses malloc() the create a copy of the string,
// so free() must be used to free storage used by the string.
// Macros: filePATH(fileName)
// See also: +copyFileName:, +extractFileNameExt:, +extractFileExt:
//
// -------------------------------------------------------------------------------------
@end